//
//  PullRefreshManager.h
//  TooToo
//  下拉刷新类
//  Created by liuning on 15/10/22.
//  Copyright © 2015年 MoHao. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^PullDownHandler)(void);
typedef void(^LoadMoreHandler)(void);

@interface PullRefreshManager : NSObject

@property (nonatomic,weak)UIScrollView * scrollView;

//当前页码的标示
@property (nonatomic,assign,readonly)NSInteger curPageIndex;

//执行下拉刷新的操作
@property (nonatomic,strong)PullDownHandler refreshAction;

//执行加载更多的操作
@property (nonatomic,strong)LoadMoreHandler loadMoreAction;

//判断是否是激活状态，也就是scrollView是否正在Loading
@property (nonatomic,assign,readonly)BOOL isActive;

//判断是否是下拉刷新成功，（用于外部判断是否需要清空数组数据，下拉刷新的时候清空，加载更多的时候不清空）
@property (nonatomic,assign,readonly)BOOL isRefreshSucceed;

//添加下拉刷新或分页加载
-(void)addScrollView:(UIScrollView *)scrollView needPullDown:(BOOL)needPullDown needLoadMore:(BOOL)needLoadMore;

//移除下拉刷新页面
-(void)removeRefreshView;

//把当前页码设置为第一页，如果多个Tab公用一个scrollView，在切换Tab的时候，需要将当前页码值归初
-(void)refreshCurPageToOrigin;

//加载成功的时候调用
-(void)requestSucceed;

//加载失败的时候调用
-(void)requestFaild;

//是否滑到最后
-(void)judgeTheEndByCurrentNum:(NSInteger)currentNum andTotalNum:(NSInteger)totalNum;

//是否滑到最后，一般用上面的方法
-(void)reachedTheEnd:(BOOL)end;

//添加标头水印
-(void)addTopLogo;

@end
